﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Web.Models.ViewModels
{
    public class LoginViewModel
    {
        [DisplayName("账号")]
        [Required(ErrorMessage = "请输入{0}")]
        [MaxLength(20)]
        public string UserName { get; set; }

        [DisplayName("密码")]
        [Required(ErrorMessage = "请输入{0}")]
        [DataType(DataType.Password)]
        [MaxLength(32)]
        public string Password { get; set; }

        public bool Remember { get; set; }

        [DisplayName("图形验证码")]
        [Required]
        [StringLength(4)]
        public string VerCode { get; set; }
    }

    public class UserLoginViewModel
    {
        [DisplayName("账号")]
        [Required(ErrorMessage = "请输入{0}")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "{0}必须是{2}到{1}个字")]
        public string Account { get; set; }

        [DisplayName("密码")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "{0}必须是{2}到{1}位")]
        [Required(ErrorMessage = "请输入{0}")]
        public string Password { get; set; }

        public bool Remember { get; set; }
    }

    public class UserRegisterViewModel
    {
        [DisplayName("账号")]
        [Required(ErrorMessage = "请输入{0}")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "{0}必须是{2}到{1}个字")]
        public string Account { get; set; }

        [DisplayName("密码")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "{0}必须是{2}到{1}位")]
        [Required(ErrorMessage = "请输入{0}")]
        public string Password { get; set; }

        [DisplayName("确认密码")]
        [Compare("Password",ErrorMessage = "两次输入的密码不一样")]
        public string ConfirmPassword { get; set; }
    }

    public class UserLoginWithValidateCodeViewModel : UserLoginViewModel
    {
        [DisplayName("验证码")]
        [Required(ErrorMessage = "请输入{0}")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "请输入正确的{0}")]
        public string ValidateCode { get; set; }
    }

    public class UserRegisterWithValidateCodeViewModel:UserRegisterViewModel
    {
        [DisplayName("验证码")]
        [Required(ErrorMessage = "请输入{0}")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "请输入正确的{0}")]
        public string ValidateCode { get; set; }
    }
}
